package com.ruoyi.project.jiaqin.quotationcollect.service.impl;

import com.ruoyi.common.utils.text.Convert;
import com.ruoyi.project.jiaqin.quotationcollect.domain.QuotationCollect;
import com.ruoyi.project.jiaqin.quotationcollect.mapper.QuotationCollectMapper;
import com.ruoyi.project.jiaqin.quotationcollect.service.IQuotationCollectService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.UUID;

/**
 * 行情收藏Service业务层处理
 * 
 * @author LCL
 * @date 2021-10-23
 */
@Service
public class QuotationCollectServiceImpl implements IQuotationCollectService 
{
    @Autowired
    private QuotationCollectMapper quotationCollectMapper;

    /**
     * 查询行情收藏
     * 
     * @param id 行情收藏ID
     * @return 行情收藏
     */
    @Override
    public QuotationCollect selectQuotationCollectById(String id)
    {
        return quotationCollectMapper.selectQuotationCollectById(id);
    }

    /**
     * 查询行情收藏列表
     * 
     * @param quotationCollect 行情收藏
     * @return 行情收藏
     */
    @Override
    public List<QuotationCollect> selectQuotationCollectList(QuotationCollect quotationCollect)
    {
        return quotationCollectMapper.selectQuotationCollectList(quotationCollect);
    }

    /**
     * 新增行情收藏
     * 
     * @param quotationCollect 行情收藏
     * @return 结果
     */
    @Override
    public int insertQuotationCollect(QuotationCollect quotationCollect)
    {
        quotationCollect.setId(UUID.randomUUID().toString().replace("-",""));
        return quotationCollectMapper.insertQuotationCollect(quotationCollect);
    }

    /**
     * 修改行情收藏
     * 
     * @param quotationCollect 行情收藏
     * @return 结果
     */
    @Override
    public int updateQuotationCollect(QuotationCollect quotationCollect)
    {
        return quotationCollectMapper.updateQuotationCollect(quotationCollect);
    }

    /**
     * 删除行情收藏对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteQuotationCollectByIds(String ids)
    {
        return quotationCollectMapper.deleteQuotationCollectByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除行情收藏信息
     * 
     * @param id 行情收藏ID
     * @return 结果
     */
    @Override
    public int deleteQuotationCollectById(String id)
    {
        return quotationCollectMapper.deleteQuotationCollectById(id);
    }

    @Override
    public QuotationCollect selectQuotatioCollectByMemberIdAndToQuotatioId(String memberId, String toQuotationId) {
        return quotationCollectMapper.selectQuotatioCollectByMemberIdAndToQuotatioId(memberId, toQuotationId);
    }
}
